Trying to get jtag working on the z2

1) wire up all the jtag signals
    a) nSRST needs to be connected to the little reset button
    b) I have 4 91k pullups to vTarget
    c) I have vTarget connected to teh gold pad near the power chip pin10
2) get the latest openocd sources (tested with svn 838)
3) get the latest fdti libfdti2xx (tested with libftdi2xx0.4.13)
4) put WinTypes.h and ftd2xx.h into the /openocd/src/jtag directory
5) run ./bootsrtap from /openocd
6) run ./configire --enable-ft2232-ftd2xx
7) run make
9) copy the resulting openocd executable from /openocd/src somewhere handy say /xyz/
10) copy /openocd/src/target/xscale/debug_handler.bin to /xyz/xscale/
11) use the following .cfg file:

# config for Intel PXA270
# not, as of 2007-06-22, openocd only works with the
# libftd2xx library from ftdi.  libftdi does not work.

# daemon configuration

telnet_port     3333
gdb_port        4444
tcl_port        6666

# Interface configuration

interface ft2232
ft2232_device_desc "Flyswatter"
ft2232_layout "flyswatter"
ft2232_vid_pid 0x0403 06010
jtag_speed 0

# set jtag_nsrst_delay to the delay introduced by your reset circuit
# the rest of the needed delays are built into the openocd program
jtag_nsrst_delay 260
# set the jtag_ntrst_delay to the delay introduced by a reset circuit
# the rest of the needed delays are built into the openocd program
jtag_ntrst_delay 250

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 7 0x1 0x7f 0x7e

#target configuration
#target <type> <endianess> <reset mode>
target xscale little reset_halt 0 pxa27x
#target_script 0 reset ./z2.ocd

# maps to PXA internal RAM.  If you are using a PXA255
# you must initialize SDRAM or leave this option off
working_area 0 0x5c000000 0x10000 nobackup

run_and_halt_time 0 30

#flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options..]

flash bank cfi 0x00000000 0x1000000 2 2 0

12) make sure you have usbfs mounted on /proc/bus/usb
13) connect the flyswatter to the pc's usb port
14) connect the z2 to the flyswatter
14a) plug in the z2's wall adapter to power and to the z2
14b) do not push the z2's power button
15) as root in /xyz run ./openocd -f z2.cfg
16) as a normal user run telnet localhost 3333
17) you should get the openocd prompt
18) at the prompt run the command "reset halt"
19) you should then be able to probe the flash, step, read and write flash memory.
20) to be able to use SDRAM, you must set up the PXA270's config registers,
the subject of a future update.